<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			姓:<input type="text" v-model="xing"/><br />
			名:<input type="text" v-model="ming"><br />
			姓名:<a v-text="xingming"></a>
		</div>
		
		<script src="../js/vuejs-2.5.16.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">
			const vue = new Vue({
				el: "#app",
				data: {
					xing:"",
					ming:"",
					xingming:""
				},
				/* 
				需要自动触发的时候，编写监听器
				
				姓名监听器 
				 */
				watch:{
					xing:function(val){
						this.xingming = val+this.ming;
					},
					ming:function(val){
						this.xingming = this.xing+val;
					}
				}
			})
		</script>
		
	</body>
</html>
